import React from 'react';
import {useLocation} from "react-router-dom";
import {SecurityUser} from "type/entity/SecurityUser";
import TreeEnhance from "common/tree/TreeEnhance";

const UserMenuComponent = () => {
    const user = useLocation().state as SecurityUser;
    const footer = <>
        <p style={{fontSize: "18px", fontWeight: "bold"}}>操作说明 : </p>
        <ul>
            <li>选择菜单后, 点击提交修改按钮即可修改用户的菜单权限</li>
            <li>提交修改后如果需要立即生效, 点击刷新按钮, 刷新之后被修改的用户菜单直接生效</li>
            <li>提交修改并后就不可以撤销到初始状态</li>
        </ul>
    </>;
    return (
        <TreeEnhance
            optionId={user.id}
            title={"用户菜单权限"}
            subText={user.username}
            tagInfo={user.identity}
            dataUrl={"/manager/admin/user-menu/authority-tree/"}
            updateUrl={"/manager/admin/user-menu/authority-tree"}
            refreshUrl={"/root/refresh/user-menu/" + user.username}
            refreshTreeUrl={"/root/refresh/menu-tree"}
            backupText={"用户列表"}
            footer={footer}
        />
    );
};

export default UserMenuComponent;